package uniandes.cupi2.photoViewer.interfaz;

import javax.swing.JPanel;
import javax.swing.border.TitledBorder;
import java.awt.Dimension;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class PanelOpciones extends JPanel implements ActionListener{
	
	
	private final static String AGREGAR_ALBUM = "Agregar album";
	private final static String ELIMINAR_ALBUM = "Eliminar album";
	
	private InterfazPhotoViewer principal;

	/**
	 * Create the panel.
	 */
	public PanelOpciones(InterfazPhotoViewer ventana) {
		
		principal = ventana;
		setPreferredSize(new Dimension(700, 70));
		setBorder(new TitledBorder(null, "Opciones", TitledBorder.LEADING, TitledBorder.TOP, null, null));
		
		
		JButton btnAgregarAlbum = new JButton(AGREGAR_ALBUM);
		btnAgregarAlbum.setActionCommand(AGREGAR_ALBUM);
		btnAgregarAlbum.addActionListener(this);
		add(btnAgregarAlbum);
		
		JButton btnEliminarAlbum = new JButton(ELIMINAR_ALBUM);
		btnEliminarAlbum.setActionCommand(ELIMINAR_ALBUM);
		btnEliminarAlbum.addActionListener(this);
		add(btnEliminarAlbum);

	}
	
	public void actionPerformed(ActionEvent cursor)
	{
		String comando = cursor.getActionCommand();
		if(comando.equals(AGREGAR_ALBUM))
		{
			principal.abrirDialogoAgregarAlbum();			
		}
		else if(comando.equals(ELIMINAR_ALBUM))
		{
			principal.abrirDialogoEliminarAlbum();
		}
	}

}
